import axiosApi from './AxiosApi.js'

const apiList = {
  page: {
    method: 'GET',
    url: `http://localhost:8185/base/truck/page`
  },
  truckTypeQueryall:{
    method:'GET',
    url:`http://localhost:8185/base/truck/type/queryAll`
  },
  fleetQueryall:{
    method:'GET',
    url:`http://localhost:8185/sys/agency/fleet/queryAll`
  },
  save:{
    method:'POST',
    url:`http://localhost:8185/base/truck`
  }

}

export default {
  //分页查询车队
  queryAll (search) {
    return axiosApi({
      ...apiList.page,
      formData: true,
      data:{
        page:search.page,
        pageSize:search.pageSize,
        truckTypeId:search.truckTypeId,
        licensePlate:search.licensePlate,
        fleetId:search.fleetId
      },
    })
  },
  //查询所有车辆类型
  truckTypeQueryall(){
    return axiosApi({
      ...apiList.truckTypeQueryall,
      formData: true,
    })
  },
  //查询所有车队
  fleetQueryAll(){
    return axiosApi({
      ...apiList.fleetQueryall,
      formData: true,
    })
  },
  del(id){
    return axiosApi({
      method:'PUT',
      url:`http://localhost:8185/base/truck/${id}/disable`
    })
  },
  //修改车辆
  upd(id,TruckDto){
    return axiosApi({
      method:'PUT',
      url:`http://localhost:8185/base/truck/${id}`,
      data:TruckDto
    })
  },
  //增加车辆
  save(TruckDto){
    return axiosApi({
      ...apiList.save,
      data:TruckDto
    })
  },
  //根据车辆id查询车辆的基本信息
  queryByIdTruck(id){
    return axiosApi({
      method:'GET',
      url:`http://localhost:8185/base/truck/${id}`
    })
  },
  //根据车辆id查询车辆的行驶证信息
  queryByIdTruckLicense(id){
    return axiosApi({
      method:'GET',
      url:`http://localhost:8185/base/truck/license/${id}/truckid`
    })
  }
  //根据车辆id查询车次信息

}

